package com.xbongbong.pro.message.pojo.dto;

import com.alibaba.dingtalk.openapi.newmessage.entity.OA;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.pro.enums.DistributorMarkEnum;
import com.xbongbong.pro.message.pojo.PushRefTypePojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import java.util.List;

@Setter
@Getter
@ToString
public class DistributorMessageRabbitMqDTO extends MessageRabbitMqDTO {

    private Long distributorId;

    /**
     * 经销商标识 1：经销商 0：非经销商
     */
    private Integer distributorMark = DistributorMarkEnum.OTHER.getCode();

    public DistributorMessageRabbitMqDTO() {

    }

    public DistributorMessageRabbitMqDTO(@NotNull(message = "公司id不可为空") String corpid, @NotNull(message = "被推送对象不可为空") List<String> userIds, List<Long> refIds, Integer remind, Long pushTime, @NotNull(message = "消息体的标题不可为空") String title, String content, List<OA.Body.Form> form, @NotNull(message = "options不可为空") PushRefTypePojo.Options options, @NotNull(message = "distributorMark不可为空") Integer distributorMark) {
        this.corpid = corpid;
        this.userIds = userIds;
        this.refIds = refIds;
        this.remind = remind == null ? 0 : remind;
        this.pushTime = pushTime == null ? DateTimeUtil.getInt() : pushTime;
        this.title = title;
        this.content = content;
        this.form = form;
        this.options = options;
        this.distributorMark = distributorMark;
    }
}
